﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;

namespace OnlineCatalog
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "DemoWcfService" in code, svc and config file together.
    // NOTE: In order to launch WCF Test Client for testing this service, please select DemoWcfService.svc or DemoWcfService.svc.cs at the Solution Explorer and start debugging.
    public class DemoWcfService : IDemoWcfService
    {
        public IEnumerable<Controllers.CategoryModel> GetAllCategories()
        {
            var db = new Model1Container();
            return db.CategorySet.Select(it =>
                new Controllers.CategoryModel
                {
                    Id = it.Id,
                    Name = it.Name,
                }).ToList();
        }
    }
}
